Skip to content

feat(http): 🔧 Simplify HTTP request methods to use post and get directly#24

Open
cl-bruant-steineur wants to merge 2 commits into
Scolup:mainfrom
cl-bruant-steineur:refactor/http-client
Open

feat(http): 🔧 Simplify HTTP request methods to use post and get directly#24
cl-bruant-steineur wants to merge 2 commits into
Scolup:mainfrom
cl-bruant-steineur:refactor/http-client

Conversation

@cl-bruant-steineur
Copy link
Copy Markdown

@cl-bruant-steineur cl-bruant-steineur commented May 22, 2026

  • Replaced this.http.request with this.http.post and this.http.get in multiple modules for cleaner code.
  • Updated methods in AbsencesModule, CloudModule, DocumentsModule, GradesModule, HomeworkModule, MessagingModule, SettingsModule, TimelineModule, and TimetableModule.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Standardized HTTP request methods across all API modules (authentication, messaging, documents, grades, homework, cloud storage, absences, timetable, timeline, and settings) for improved code consistency.
    • Enhanced the underlying HTTP request infrastructure to provide more maintainable and organized request handling throughout the application.

Review Change Stack

…irectly

* Replaced `this.http.request` with `this.http.post` and `this.http.get` in multiple modules for cleaner code.
* Updated methods in `AbsencesModule`, `CloudModule`, `DocumentsModule`, `GradesModule`, `HomeworkModule`, `MessagingModule`, `SettingsModule`, `TimelineModule`, and `TimetableModule`.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Warning

Rate limit exceeded

@cl-bruant-steineur has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 56 minutes and 37 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ce81e4c-96ea-452d-aa86-0a061d0a65b6

📥 Commits

Reviewing files that changed from the base of the PR and between 5616d6c and b0a0afa.

📒 Files selected for processing (1)
  • src/utils/http.ts
📝 Walkthrough

Walkthrough

This PR refactors HTTP client method routing by introducing lowercase verb parameters and convenience wrappers, then migrates all API call sites across authentication, data access, messaging, and settings modules to use the new methods consistently.

Changes

HTTP Client Refactoring and Module Migration

Layer / File(s) Summary
HTTP Client Infrastructure Refactoring
src/utils/http.ts
HttpClient.request parameter type changes from uppercase 'GET' | 'POST' method to lowercase 'get' | 'post' verbe; fetch always uses method: "POST" with the verb encoded in a verbe query parameter. A debug console.log is added after response parsing. New get() and post() convenience methods wrap request() to standardize calling patterns.
Authentication Flow Migration
src/index.ts
login(), directLogin(), and submit2FA() methods replace http.request('POST', ...) with http.post(...) for login and 2FA challenge endpoints, preserving payload structure and success callbacks.
Academic Data Modules Migration
src/modules/AbsencesModule.ts, src/modules/DocumentsModule.ts, src/modules/GradesModule.ts, src/modules/TimetableModule.ts, src/modules/TimelineModule.ts
getAbsences, getDocuments, getGrades, getTimetable/getIcalUrl, and getStudentTimeline/getCommonTimeline switch from http.request to http.get or http.post, keeping endpoints, payloads, and response mappings unchanged.
Cloud Storage Operations Migration
src/modules/CloudModule.ts
getCloudFiles, createFolder, copyNodes, deleteNodes, restoreNodes, and exportToCloud replace http.request('POST', ...) with http.post(...) while preserving request structure and response handling.
Homework and Messaging Modules Migration
src/modules/HomeworkModule.ts, src/modules/MessagingModule.ts
HomeworkModule.getHomework, markAsDone, addComment and MessagingModule message retrieval, state transitions, and folder operations switch from http.request to http.post, keeping payloads and response extraction logic unchanged.
Settings Module Migration
src/modules/SettingsModule.ts
updateIndividualParam, updateAccountSettings, and getAccountSettings replace http.request('POST', ...) with http.post(...), preserving endpoint paths and option structures.

🎯 4 (Complex) | ⏱️ ~45 minutes

🐰 With verbs now whispered as query friends,
And POST embracing every end,
From auth to grades, the modules align—
No request bloat, just helpers fine.
A rabbit's refactor, clean and spry! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: replacing generic http.request calls with more specific post and get convenience methods across the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/http.ts`:
- Line 97: The debug console.log line leaks sensitive data (headers:
X-Token/X-Gtk and potentially body with credentials); remove or replace it with
a sanitized log. Locate the console.log(url.toString(), verbe, body, params,
headers, result) call and either delete it or call a logger with a sanitized
payload: strip or mask header keys "X-Token" and "X-Gtk" and redact credential
fields in body before logging (implement a small sanitizer helper used here).
Ensure the final log only includes non-sensitive values (e.g., url, verbe,
params, result status) and never raw headers or full body content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 42502ac8-2df9-4877-9fc2-4569a03e7568

📥 Commits

Reviewing files that changed from the base of the PR and between d712143 and 5616d6c.

📒 Files selected for processing (11)
  • src/index.ts
  • src/modules/AbsencesModule.ts
  • src/modules/CloudModule.ts
  • src/modules/DocumentsModule.ts
  • src/modules/GradesModule.ts
  • src/modules/HomeworkModule.ts
  • src/modules/MessagingModule.ts
  • src/modules/SettingsModule.ts
  • src/modules/TimelineModule.ts
  • src/modules/TimetableModule.ts
  • src/utils/http.ts

Comment thread src/utils/http.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant